package com.david.http.http.interceptor

import okhttp3.Interceptor
import okhttp3.Response

class HeaderInterceptor(
    private val headers: Map<String, String>
    ): Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val requestBuilder = chain.request().newBuilder()
        for ((key, value) in headers) {
            requestBuilder.header(key, value)
        }

        // TODO: 校验处理
        return chain.proceed(requestBuilder.build())
    }
}